package com.zyj.java;

/**
 * @program: JVMDemo
 * @ClassName ClInitTest1
 * @author: YaJun
 * @Date: 2021 - 12 - 01 - 11:50
 * @Package: com.zyj.java
 * @Description:
 */
public class ClInitTest1 {

    static class Father {
        public static int A = 1;

        static {
            A = 2;
        }
    }

    static class Son extends Father{
        public static int B = A;
    }


    public static void main(String[] args) {
        // 先加载Father类，再加载Son类
        System.out.println(Son.B);  // 2
    }

}
